package com.wanbangee.marksystem.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.service.QueryExcellenceAndErrAnswerSheetService;
import com.wanbangee.marksystem.service.QueryTopicScoreService;
import com.wanbangee.marksystem.service.QueryTopicScoreTypeService;

@CrossOrigin
@RestController
@RequestMapping("/topicNoScoreInfo")
public class QueryExcellenceAndErrAnswerSheetController {

	@Autowired
	private QueryExcellenceAndErrAnswerSheetService queryExcellenceAndErrAnswerSheetService;
	
	@Autowired
	private QueryTopicScoreTypeService queryTopicScoreTypeService;
	
	@Autowired
	private QueryTopicScoreService queryTopicScoreService;
	
	@GetMapping("/selectExcellenceAndErrAnswerSheet")
	public Map<String, Object> selectExcellenceAndErrAnswerSheet(Integer examId,Integer subId,Integer claId,String topicNo,Integer recordType){
		Map<String, Object> map = new HashMap<>();
		map.put("image", this.queryExcellenceAndErrAnswerSheetService.selectExcellenceAndErrAnswerSheet(examId, subId, claId, topicNo, recordType));
		return map;
	}
	
	@GetMapping("/selectStuSubjective")
	public Integer selectTopicScoreType(Integer examId,Integer subId,String topicNo){
		return this.queryTopicScoreTypeService.selectScoreTypeByExamIdAndSubIdAndTopicNo(examId, subId, topicNo);
	}
	
	@GetMapping("/selectSubjectiveDistribution")
	public Double selectSubjectiveDistribution(Integer examId,Integer subId,String topicNo) {
		return this.queryTopicScoreService.selectTopicScoreByExamIdAndSubIdAndTopicNo(examId, subId, topicNo);
	}
}
